# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt5-qtimageformats
pkgver=5.15.5_git20220617
pkgrel=0
_commit="b7313c6963033a027c31049daf6bacc6138e127a"
pkgdesc="Qt5 - QtImageFormats component"
url="https://www.qt.io/developers/"
arch="all"
license="(LGPL-2.0-or-later OR GPL-3.0-only OR GPL-2.0-or-later) AND Qt-GPL-exception-1.0"
makedepends="
	libmng-dev
	libwebp-dev
	qt5-qtbase-dev
	tiff-dev
	"
builddir="$srcdir/qtimageformats-$_commit"

case $pkgver in
	*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="https://invent.kde.org/qt/qt/qtimageformats/-/archive/$_commit/qtimageformats-$_commit.tar.gz"

prepare() {
	default_prepare

	# We need to make the build system think we're running in a git repository
	# so it correctly symlinks during the build
	mkdir .git
}

build() {
	qmake-qt5
	make
}

check() {
	make check
}

package() {
	make install INSTALL_ROOT="$pkgdir"

	# Drop QMAKE_PRL_BUILD_DIR because reference the build dir
	find "$pkgdir/usr/lib" -type f -name '*.prl' \
		-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;

	install -d "$pkgdir"/usr/share/licenses
	ln -s /usr/share/licenses/qt5-base "$pkgdir"/usr/share/licenses/$pkgname
}

sha512sums="
53a7602d851128a37e55c9a96218991c83d6f4fa94733c490daac7e601beefba1b7acf4c0795c3e1e2763dad6a5719d21e75482b8e1ee5e2311d6d2469e622a8  qtimageformats-b7313c6963033a027c31049daf6bacc6138e127a.tar.gz
"
